package com.zxh.service.impl;

import com.zxh.dao.UserMapper;
import com.zxh.pojo.User;
import com.zxh.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> getUserList() {
        return userMapper.getUserList();
    }

    @Override
    public User getUserByLogin(String userCode, String userPassword) {
        return userMapper.getUserByLogin(userCode,userPassword);
    }

    @Override
    public int getUserCountByParams(String userName, Integer userRole) {
        return userMapper.getUserCountByParams(userName, userRole);
    }

    @Override
    public List<User> getUserListByParams(Map<String, Object> params) {
        return userMapper.getUserListByParams(params);
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public User getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    @Override
    public int delUserById(Integer id) {
        return userMapper.delUserById(id);
    }

    @Override
    public int checkUserCountByCode(String usercode) {
        return userMapper.getUserCountByCode(usercode);
    }

    @Override
    public int checkUserOfId(String usercode, Integer id) {
        return userMapper.checkUserCodeOfId(usercode, id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }
}
